<?php
function getFilePaths($path = null)
{
    $iterator = new FileSystemIterator($path);
    $localFilePaths = [];
    foreach ($iterator as $value) {
        if ($value->isdir()) {
            $_localFilePath = getFilePaths($path . DIRECTORY_SEPARATOR . $value->getFilename());
            $localFilePaths = array_merge($localFilePaths, $_localFilePath);
        } else {
            $localFilePaths[] = $path . DIRECTORY_SEPARATOR . $value->getFilename();
        }
    }
    return $localFilePaths;
}
